﻿public class Line {
	private Point endPoint;
	private Point startPoint;

	public Point getEndPoint() {
		return endPoint;
	}

	public void setEndPoint(Point newEndPoint) {
		endPoint = newEndPoint;
	}

	public Point getStartPoint() {
		return startPoint;
	}

	public void setStartPoint(Point newStartPoint) {
		startPoint = newStartPoint;
	}

	/**
	 * 根据给定起点和终点或随机画线。
	 */
	public Line drawLine(Point startPoint, Point endPoint) {
		Point point = new Point();
		if (startPoint == null) {
			// Point point = new Point();
			startPoint = point.drawPoint();
		}
		this.setStartPoint(startPoint);
		if (endPoint == null) {
			// Point point = new Point();
			endPoint = point.drawPoint();
		}
		this.setEndPoint(endPoint);
		return this;
	}

	// public static void main(String[] args) {
	// Point startPoint = null;
	// Point endPoint = null;
	// Line line = new Line();
	// line.drawLine(startPoint, endPoint);
	// System.out.println(line.getStartPoint().getX()+"sss"+line.getStartPoint().getY()
	// + "  " + line.getEndPoint());
	// }
}